package com.lbl.ClassLoaderTest02;

import java.sql.DriverManager;

public class ClassLoaderTest01 {
    public static void main(String[] args) throws ClassNotFoundException {
        //1.获取当前类的ClassLoader
        Class<?> clazz = Class.forName("java.lang.String");
        ClassLoader classLoader = clazz.getClassLoader();
        System.out.println(classLoader);//null

        //2.获取当前线程上下文的ClassLoader
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        System.out.println(contextClassLoader);//sun.misc.Launcher$AppClassLoader@18b4aac2

        //3.获取系统的ClassLoader
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);//sun.misc.Launcher$AppClassLoader@18b4aac2

    }
}
